﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserEdit.aspx.cs" Inherits="Invoicing.sys.UserEdit" %>
<style type="text/css" media="screen">
.my-uploadify-button {
	background:none;
	border: none;
	text-shadow: none;
	border-radius:0;
}

.uploadify:hover .my-uploadify-button {
	background:none;
	border: none;
}

.fileQueue {
	width: 400px;
	height: 150px;
	overflow: auto;
	border: 1px solid #E5E5E5;
	margin-bottom: 10px;
}
</style>
<script src="../js/json2.js"></script>

<script type="text/javascript">

    function uploadSuccess(file, data, response) {
        var result = JSON.parse(data);
        if (result.as == 200) {
            $("#txdisplay").attr("src", "../TxFile/" + result.meg);
            $("#txtimg").val(result.meg);
        }
    }


    function uploadComplete(queueData) {
        //var msg = "The total number of files uploaded: " + queueData.uploadsSuccessful + "<br/>" + "The total number of errors while uploading: " + queueData.uploadsErrored + "<br/>" + "The total number of bytes uploaded: " + queueData.queueBytesUploaded + "<br/>" + "The average speed of all uploaded files: " + queueData.averageSpeed;
        if (queueData.uploadsErrored) {
            // alertMsg.error("上传失败");
        } else {
            //alertMsg.correct("上传成功");
        }
    }
</script>

<div class="pageContent">    
        <form id="form1" method="post" action="AJAX/Userinfo.ashx" class="pageForm required-validate" onsubmit="return validateCallback(this,dialogAjaxDone)">
        <input type="hidden" name="action" value="edit" />
        <input type="hidden" name="txtimg" id="txtimg" value="<%=Umodel.u_img %>" />
        <input type="hidden" name="uid"  value="<%=Umodel.uid %>"/>
        <input  type="hidden" name="txtpower" value=""/>
            <div class="pageFormContent" layoutH="50">

        <fieldset>
		<legend>用户基本信息</legend>
                <p>                                       
                    <label>用户名称：</label>
                    <input type="text" name="txtusername" size="30"  readonly="true" value="<%= Umodel.u_userName %>"  maxlength="50"  class="required" alt=""  />
                </p>
               
                <p>
                    <label>用户姓名：</label>
                    <input type="text" name="txtrueName" size="30" maxlength="50" value="<%= Umodel.u_trueName %>"   class="required" alt="" />
                </p>
                <p>
                    <label>用户邮箱：</label>
                    <input type="text" name="txtemail" size="30" maxlength="50"  value="<%= Umodel.u_email %>"  class="required email" alt="" />
                </p>
                <p>
                    <label>用户电话：</label>
                    <input type="text" name="txtmobile" size="30" maxlength="50"  value="<%= Umodel.u_mobilePhone %>"   class="phone" alt="" />
                </p>
              
                <p>
                    <label>用户部门：</label>
                    <select name="upid" id="upid" style="width:184px">
                      
                       <%
                           
                       foreach  (ZY.Model.Tab_DeptInfo item in DeptList)
                       {
                           
                       %>  
                              <option  value="<%= item.dp_id %>"><%=item.dp_namme %></option>
                                
                       <%

                       }    
                        
                       %>
                            
                    </select>

                </p>
                <p>
                    <label>用户角色：</label>
                    <select name="rid" id="rid" style="width:184px">
                       <%
                           
                           foreach (ZY.Model.Tab_RoleInfo item in RoleList)
                       {
                           
                       %>  
                              <option  value="<%= item.rid %>"><%=item.r_name %></option>
                       <%

                       }    
                        
                       %>
                    </select>

                </p>
                <p>
                    <label>用户级别：</label>
                    <select name="uleve" id="uleve" style="width:184px">
                        <option  value="0">高级</option>
                        <option  value="1">中级</option>
                        <option  value="2">低级</option>
                    </select>
                </p>

                 <p>
                    <label>用户职位：</label>
                   <select name="upostion" id="upostion" style="width:184px">
                    <%
                           
                        foreach (ZY.Model.Tab_Poistion item in PoistionList)
                       {
                           
                    %>  
                              <option  value="<%= item.pid %>"><%=item.p_name %></option>    
                    <%

                       }    
                        
                    %>
                    </select>

                </p>
                <p>
                    <label>用户状态：</label>
                    <select name="ddlstate" id="ddlstate" style="width:184px">
                        <option  value="1">启用</option>
                        <option  value="0">禁用</option>
                     
                    </select>

                </p>

                  <p>
                    <label>用户地址：</label>
                    <input type="text" name="txtaddres" size="30" maxlength="50"  value="<%= Umodel.u_address %>"   alt="" />
                </p>
              <p>
                    <label>用户备注：</label>
                    <input type="text" name="txtnote" size="30" maxlength="50"  value="<%= Umodel.u_note %>"     alt="" />
                </p>
                

</fieldset>
 <fieldset>
		<legend>形象照片</legend>

        <div id="tximgs">
               <table style="width:220px; border:0" style="text-align:right" >
                   <tr >
                       <td> <img alt="tx" id="txdisplay" src="/TxFile/<%= Umodel.u_img %>" width="150" height="150" /></td>
                       <td valign="bottom">
                            	<input id="testFileInput" type="file" name="image" uploaderOption="{
			swf:'uploadify/scripts/uploadify.swf',
			uploader:'/AJAX/UploadFile.ashx',
			buttonText:'请选择文件',
			fileSizeLimit:'400KB',
			fileTypeDesc:'*.jpg;*.jpeg;*.gif;*.png;',
			fileTypeExts:'*.jpg;*.jpeg;*.gif;*.png;',
			auto:true,
			multi:false,
			onUploadSuccess:uploadSuccess,
			onQueueComplete:uploadComplete
		}"
	/>
                       </td>
                   </tr>

               </table>
        </div>
        
</fieldset>
</div>
     <div class="formBar">
                <ul>
                    <li><div class="buttonActive"><div class="buttonContent"><button type="submit">提交</button></div></div></li>
                    <li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
                </ul>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        //绑定等级
        var r_leve =<%= Umodel.u_leve%>  
        var items = $("#uleve> option");   
        items.each(function (i) {
            if (items[i].value==r_leve) {
                $(items[i]).attr("selected","selected")
            } 
        })
        //绑定职位
        var p_id =<%= Umodel.pid%>  
        var pitems = $("#upostion> option");   
        pitems.each(function (i) {
            if (pitems[i].value==p_id) {
                $(pitems[i]).attr("selected","selected")
            } 
        })
        //绑定角色
        var r_id =<%= Umodel.rid%>  
        var rtems = $("#rid> option");   
        rtems.each(function (i) {
            if (rtems[i].value==r_id) {
                $(rtems[i]).attr("selected","selected")
            } 
        })
        //绑定部门
        var dp_id =<%= Umodel.dp_id%>  
        var dptems = $("#upid> option");   
        dptems.each(function (i) {
            if (dptems[i].value==dp_id) {
                $(dptems[i]).attr("selected","selected")
            } 
        })
        //绑定用户状态
        var ustate =<%= Umodel.u_state%>  
        var stateitem = $("#ddlstate> option");   
        stateitem.each(function (i) {
            if (stateitem[i].value==ustate) {
                $(stateitem[i]).attr("selected","selected")
            } 
        })

        


    </script>



